﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Plateformeur.GameEntities
{
    class Ennemy : Gravity
    {

        static public List<Ennemy> sList = new List<Ennemy>();

        public Ennemy(Vector2 pPosition)
            :base(new Vector2(-1, 0), 10.0f, "SpriteSheet_Enemy", pPosition) 
        {
            mRenderedRect = new Rectangle(0, 0, 32, 26);

            sList.Add(this);

            AddAnimation("walk", "SpriteSheet_Enemy", 0.5f, 4);
            Play("walk");
        }


        public override void Update(GameTime pTime)
        {
            if (Position.X < -50)
            {
                sList.Remove(this);
                Game.Components.Remove(this);
            }

            base.Update(pTime);
        }

        public void Destroy()
        {
            Game.Components.Remove(this);
        }
    }
}
